﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

<!--活动公告列表-->
<div class="act_list w_980 clearfix">
	<!--left-->
	<div class="act_left">
        <!--title-->
        <div class="info_box_title">
            <h3>活动公告列表</h3>
            <p><a href="/index.html">首页</a>&gt;<a href="/template/noticelist.html">活动公告列表</a></p>
        </div>
        <%
            BIZ.InfomationPublishOper ipo = new BIZ.InfomationPublishOper();
            int pageno = Request["pageno"] == null ? 1 : int.Parse(Request["pageno"].ToString());//当前页
            int pagesize = 15;//单页记录数
            int count = 0;//总记录数
            int pageNumber = 0;//总页数
            IList ligg = ipo.getlistweb(pageno, pagesize, (int)DAL.Enums.template.活动公告);
        %>
        <!--list-->
        <ul class="act_list_ul">
            <%
            int i = 1;//判断基数偶数
            foreach (Hashtable tb in ligg)
            {
                if (tb["total"] == null)
                {
                    DateTime dt1 = (tb["i_addTime"] == null ? DateTime.Now : DateTime.Parse(tb["i_addTime"].ToString()));
                    DateTime dt2 = DateTime.Now;
                    System.TimeSpan st = dt2.Subtract(dt1);
                    int day = st.Days;
                    Response.Write("<li " + (day > 7 ? "" : "class=\"ico_new"+ ((i % 2) != 0 ? " bg_li" : "") +  "\"") +"><a target=\"_blank\" href=\"/template/notice.html?i=" + (tb["i_id"] == null ? "" : tb["i_id"].ToString()) + "\">·" + (tb["i_title1"] == null ? "" : tb["i_title1"].ToString()) + "</a><span>" + (tb["i_addTime"] == null ? "" : DateTime.Parse(tb["i_addTime"].ToString()).ToString("yyyy-MM-dd")) + "</span></li>");
                    i++;
                }
                else
                    count = (tb["total"] == null ? 0 : int.Parse(tb["total"].ToString()));
            }
            %>
        </ul>
        <!--pager-->
        <div class="pager">
        <%
            pageNumber = ((count % pagesize) == 0 ? (count / pagesize) : ((count / pagesize) + 1));
            int start = pagesize * (pageno - 1) + 1;
            if (start < 0)
                start = 0;
            int end = (start + pagesize-1);
            if (pageno == pageNumber)
            {
                if ((count % pagesize) != 0)
                {
                    end = (start + (count % pagesize) - 1);
                }
            }
        %>
            <p class="left"><%=count%> 条记录，显示第 <%=start %> 条 - 第 <%=end %> 条记录</p>
            <p class="right"><a href="/template/noticelist.html?pageno=1" title="首页" class="a1 a1_n"></a>
            <a href="/template/noticelist.html?pageno=<%=(pageno==1?1:pageno-1) %>" title="上一页" class="a2"></a><span>第<b><%=pageno %></b>页/共 <%=pageNumber %> 页</span>
            <a href="/template/noticelist.html?pageno=<%=(pageno==pageNumber?pageNumber:pageno+1) %>" title="下一页" class="a3"></a><a href="/template/noticelist.html?pageno=<%=pageNumber %>" title="末页" class="a4"></a>
            <select id="sPage">
            <% 
                for (int k = 1; k <= pageNumber;k++ )
                    Response.Write("<option value=\"" + k.ToString() + "\">" + k.ToString() + "</option>");
            %>
            </select></p>
            <script type="text/javascript" language="javascript">
                $(function () {
                    $("#sPage").val(<%=pageno %>);
                    $("#sPage").change(function () {
                        window.location.href = "/template/noticelist.html?pageno=" + $("#sPage").val();
                    });
                })
            </script>
        </div>
    </div>
	<!--right-->
    <div class="act_right">
    	<!--排行榜-->
    	<% 
            Html.RenderPartial("~/Views/Shared/saveRanking.ascx");
        %> 
    </div>
</div>


</asp:Content>
